

#include <render.h>

#include <world.h>
#include <vector.h>
#include <matrix.h>

void vm_render(vm_world *world, vm_vector vect, vm_vector *dest){

  vm_vector inter;
  
  double pn_dot_v;
  vm_dot(vect, world->cam->look, &pn_dot_v);

  double t = world->t_num / (pn_dot_v - world->t_den);
  vm_vector tmp;
  vm_scale(vect, t, &tmp);
  vm_add(world->cam->location, tmp, &inter);
  #ifdef _DEBUG
  printf("[vm_render] Intersection: ");
  vm_println(inter);
  #endif

  vm_vector rendered;
  vm_transform(&vect, world->space_trans, dest);

}
